<script setup>
import { ref } from 'vue';

const childMessage = ref('来自子组件的数据');
</script>

<template>
  <div class="slotWrap">
    <!-- 具名插槽 -->
    <div class="header">
      <div class="pl-14"><slot name="header"></slot></div>
      <div><slot name="com"></slot></div>
    </div>

    <!-- 默认插槽 -->
    <div class="content">
        <slot name="content"></slot>
    </div>

    <!-- 作用域插槽 -->
    <slot name="footer" :message="childMessage"></slot>
  </div>
</template>

<style type="stylus" scoped>
.slotWrap {
  width: 100%;
  padding: 4px;

  .header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: 46px;
    line-height: 46px;
    background-image: url('/src/assets/images/titleBg.png');
    background-size: 100% 100%;
    font-size: 20px;
    margin: 10px 0 0 10px;
    padding-right: 20px;
  }

  .content {
    padding: 5px 0;
  }
}
</style>
